package com.qf.util;

import lombok.Data;

/**
 * 天--道--酬--勤
 *
 * @author LiangGaoQiang
 * @ClassName R
 * @Date: 2025/4/3 20:37
 * @Description: 描述
 */
@Data
public class R {
    private int code;
    private String msg;
    private Object data;

    public R() {
    }

    public R(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static R fail(){
        R r = new R( );
        r.setCode(40000);
        r.setMsg("失败");
        return r;
    }

    public static R fail(int code,String msg){
        R r = new R( );
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }

    public static R ok() {
        R r = new R();
        r.setCode(20000);
        r.setMsg("成功");
        return r;
    }

    public static R ok(Object data) {
        R r = new R();
        r.setCode(20000);
        r.setMsg("成功");
        r.setData(data);
        return r;
    }
}
